home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIStorageStream.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  201 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIStorageStream.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIStorageStream_h__
  6. #define __gen_nsIStorageStream_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. #ifndef __gen_nsrootidl_h__
  14. #include "nsrootidl.h"
  15. #endif
  16.  
  17. /* For IDL files that don't want to include root IDL files. */
  18. #ifndef NS_NO_VTABLE
  19. #define NS_NO_VTABLE
  20. #endif
  21. class nsIMemory; /* forward declaration */
  22.  
  23. class nsIInputStream; /* forward declaration */
  24.  
  25. class nsIOutputStream; /* forward declaration */
  26.  
  27.  
  28. /* starting interface:    nsIStorageStream */
  29. #define NS_ISTORAGESTREAM_IID_STR "604ad9d0-753e-11d3-90ca-34278643278f"
  30.  
  31. #define NS_ISTORAGESTREAM_IID \
  32.   {0x604ad9d0, 0x753e, 0x11d3, \
  33.     { 0x90, 0xca, 0x34, 0x27, 0x86, 0x43, 0x27, 0x8f }}
  34.  
  35. /**
  36.  * The nsIStorageStream interface maintains an internal data buffer that can be
  37.  * filled using a single output stream.  One or more independent input streams
  38.  * can be created to read the data from the buffer non-destructively.
  39.  */
  40. class NS_NO_VTABLE nsIStorageStream : public nsISupports {
  41.  public: 
  42.  
  43.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTORAGESTREAM_IID)
  44.  
  45.   /**
  46.      *
  47.      * Initialize the stream, setting up the amount of space that will be
  48.      * allocated for the stream's backing-store.
  49.      *
  50.      * @param segmentSize
  51.      *        Size of each segment. Must be a power of two.
  52.      * @param maxSize
  53.      *        Maximum total size of this stream. length will always be less
  54.      *        than or equal to this value. Passing PR_UINT32_MAX is safe.
  55.      * @param segmentAllocator
  56.      *        Which allocator to use for the segments. May be null, in which
  57.      *        case a default allocator will be used.
  58.      */
  59.   /* void init (in PRUint32 segmentSize, in PRUint32 maxSize, in nsIMemory segmentAllocator); */
  60.   NS_IMETHOD Init(PRUint32 segmentSize, PRUint32 maxSize, nsIMemory *segmentAllocator) = 0;
  61.  
  62.   /**
  63.      * Get a reference to the one and only output stream for this instance.
  64.      * The zero-based startPosition argument is used is used to set the initial
  65.      * write cursor position.  The startPosition cannot be set larger than the
  66.      * current buffer length.  Calling this method has the side-effect of
  67.      * truncating the internal buffer to startPosition bytes.
  68.      */
  69.   /* nsIOutputStream getOutputStream (in PRInt32 startPosition); */
  70.   NS_IMETHOD GetOutputStream(PRInt32 startPosition, nsIOutputStream **_retval) = 0;
  71.  
  72.   /**
  73.      * Create a new input stream to read data (written by the singleton output
  74.      * stream) from the internal buffer.  Multiple, independent input streams
  75.      * can be created.
  76.      */
  77.   /* nsIInputStream newInputStream (in PRInt32 startPosition); */
  78.   NS_IMETHOD NewInputStream(PRInt32 startPosition, nsIInputStream **_retval) = 0;
  79.  
  80.   /** 
  81.      * The length attribute indicates the total number of bytes stored in the
  82.      * nsIStorageStream internal buffer, regardless of any consumption by input
  83.      * streams.  Assigning to the length field can be used to truncate the
  84.      * buffer data, but can not be used when either the instance's output
  85.      * stream is in use.
  86.      *
  87.      * @See #writeInProgress */
  88.   /* attribute PRUint32 length; */
  89.   NS_IMETHOD GetLength(PRUint32 *aLength) = 0;
  90.   NS_IMETHOD SetLength(PRUint32 aLength) = 0;
  91.  
  92.   /**
  93.      * True, when output stream has not yet been Close'ed
  94.      */
  95.   /* readonly attribute boolean writeInProgress; */
  96.   NS_IMETHOD GetWriteInProgress(PRBool *aWriteInProgress) = 0;
  97.  
  98. };
  99.  
  100. /* Use this macro when declaring classes that implement this interface. */
  101. #define NS_DECL_NSISTORAGESTREAM \
  102.   NS_IMETHOD Init(PRUint32 segmentSize, PRUint32 maxSize, nsIMemory *segmentAllocator); \
  103.   NS_IMETHOD GetOutputStream(PRInt32 startPosition, nsIOutputStream **_retval); \
  104.   NS_IMETHOD NewInputStream(PRInt32 startPosition, nsIInputStream **_retval); \
  105.   NS_IMETHOD GetLength(PRUint32 *aLength); \
  106.   NS_IMETHOD SetLength(PRUint32 aLength); \
  107.   NS_IMETHOD GetWriteInProgress(PRBool *aWriteInProgress); 
  108.  
  109. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  110. #define NS_FORWARD_NSISTORAGESTREAM(_to) \
  111.   NS_IMETHOD Init(PRUint32 segmentSize, PRUint32 maxSize, nsIMemory *segmentAllocator) { return _to Init(segmentSize, maxSize, segmentAllocator); } \
  112.   NS_IMETHOD GetOutputStream(PRInt32 startPosition, nsIOutputStream **_retval) { return _to GetOutputStream(startPosition, _retval); } \
  113.   NS_IMETHOD NewInputStream(PRInt32 startPosition, nsIInputStream **_retval) { return _to NewInputStream(startPosition, _retval); } \
  114.   NS_IMETHOD GetLength(PRUint32 *aLength) { return _to GetLength(aLength); } \
  115.   NS_IMETHOD SetLength(PRUint32 aLength) { return _to SetLength(aLength); } \
  116.   NS_IMETHOD GetWriteInProgress(PRBool *aWriteInProgress) { return _to GetWriteInProgress(aWriteInProgress); } 
  117.  
  118. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  119. #define NS_FORWARD_SAFE_NSISTORAGESTREAM(_to) \
  120.   NS_IMETHOD Init(PRUint32 segmentSize, PRUint32 maxSize, nsIMemory *segmentAllocator) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(segmentSize, maxSize, segmentAllocator); } \
  121.   NS_IMETHOD GetOutputStream(PRInt32 startPosition, nsIOutputStream **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOutputStream(startPosition, _retval); } \
  122.   NS_IMETHOD NewInputStream(PRInt32 startPosition, nsIInputStream **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->NewInputStream(startPosition, _retval); } \
  123.   NS_IMETHOD GetLength(PRUint32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
  124.   NS_IMETHOD SetLength(PRUint32 aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLength(aLength); } \
  125.   NS_IMETHOD GetWriteInProgress(PRBool *aWriteInProgress) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWriteInProgress(aWriteInProgress); } 
  126.  
  127. #if 0
  128. /* Use the code below as a template for the implementation class for this interface. */
  129.  
  130. /* Header file */
  131. class nsStorageStream : public nsIStorageStream
  132. {
  133. public:
  134.   NS_DECL_ISUPPORTS
  135.   NS_DECL_NSISTORAGESTREAM
  136.  
  137.   nsStorageStream();
  138.  
  139. private:
  140.   ~nsStorageStream();
  141.  
  142. protected:
  143.   /* additional members */
  144. };
  145.  
  146. /* Implementation file */
  147. NS_IMPL_ISUPPORTS1(nsStorageStream, nsIStorageStream)
  148.  
  149. nsStorageStream::nsStorageStream()
  150. {
  151.   /* member initializers and constructor code */
  152. }
  153.  
  154. nsStorageStream::~nsStorageStream()
  155. {
  156.   /* destructor code */
  157. }
  158.  
  159. /* void init (in PRUint32 segmentSize, in PRUint32 maxSize, in nsIMemory segmentAllocator); */
  160. NS_IMETHODIMP nsStorageStream::Init(PRUint32 segmentSize, PRUint32 maxSize, nsIMemory *segmentAllocator)
  161. {
  162.     return NS_ERROR_NOT_IMPLEMENTED;
  163. }
  164.  
  165. /* nsIOutputStream getOutputStream (in PRInt32 startPosition); */
  166. NS_IMETHODIMP nsStorageStream::GetOutputStream(PRInt32 startPosition, nsIOutputStream **_retval)
  167. {
  168.     return NS_ERROR_NOT_IMPLEMENTED;
  169. }
  170.  
  171. /* nsIInputStream newInputStream (in PRInt32 startPosition); */
  172. NS_IMETHODIMP nsStorageStream::NewInputStream(PRInt32 startPosition, nsIInputStream **_retval)
  173. {
  174.     return NS_ERROR_NOT_IMPLEMENTED;
  175. }
  176.  
  177. /* attribute PRUint32 length; */
  178. NS_IMETHODIMP nsStorageStream::GetLength(PRUint32 *aLength)
  179. {
  180.     return NS_ERROR_NOT_IMPLEMENTED;
  181. }
  182. NS_IMETHODIMP nsStorageStream::SetLength(PRUint32 aLength)
  183. {
  184.     return NS_ERROR_NOT_IMPLEMENTED;
  185. }
  186.  
  187. /* readonly attribute boolean writeInProgress; */
  188. NS_IMETHODIMP nsStorageStream::GetWriteInProgress(PRBool *aWriteInProgress)
  189. {
  190.     return NS_ERROR_NOT_IMPLEMENTED;
  191. }
  192.  
  193. /* End of implementation class template. */
  194. #endif
  195.  
  196. // Factory method
  197. NS_COM nsresult
  198. NS_NewStorageStream(PRUint32 segmentSize, PRUint32 maxSize, nsIStorageStream **result);
  199.  
  200. #endif /* __gen_nsIStorageStream_h__ */
  201.